var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var cookieSession = require('cookie-session')

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');

// app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({
  extended: false
}));
app.use(cookieParser());
// app.use(express.static(path.join(__dirname, 'public')));

app.get('/', function (req, res) {
  res.cookie('a_index', new Date().getTime(), {
    maxAge: 1000 * 60 * 60
  });
  // console.log(`set cookie: _biz_=yh`);
  res.sendFile(__dirname + '/app2.html');
});

app.listen(5000, () => console.log('server started...'))

module.exports = app;